this.BX=this.BX||{};this.BX.Ui=this.BX.Ui||{};this.BX.Ui.Vue=this.BX.Ui.Vue||{};this.BX.Ui.Vue.Components=this.BX.Ui.Vue.Components||{};(function(e,t){"use strict";function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var r=null;t.Vue.component("bx-crm-form",{props:{id:{type:String,required:true},sec:{type:String,required:true},lang:{type:String,required:true,default:"en"},address:{type:String,required:true,default:function e(){return window.location.origin}},design:{type:Object,required:false,default:function e(){return{compact:true}}}},data:function e(){return{message:"",isLoading:false,obj:{}}},beforeDestroy:function e(){if(this.obj.instance){this.obj.instance.destroy()}},mounted:function e(){var t=this;var n=function e(){t.isLoading=false;t.message="";t.obj.config.data.node=t.$el;t.obj.config.data.design=i(i({},t.obj.config.data.design),t.design);t.obj.instance=window.b24form.App.createForm24(t.obj.config,t.obj.config.data);t.obj.instance.subscribeAll((function(e,n,i){e=e||{};e.form=n;t.$emit("form:"+i,e)}))};this.isLoading=true;var o=null;if(window.fetch){var s=new FormData;s.append("id",this.id);s.append("sec",this.sec);o=fetch(this.address+"/bitrix/services/main/ajax.php?action=crm.site.form.get",{method:"POST",body:s,mode:"cors"})}else{this.message="error";return}o.then((function(e){return e.json()})).then((function(e){if(e.error){throw new Error(e.error_description)}t.obj.config=e.result.config;if(window.b24form&&window.b24form.App){n();return}if(!r){r=new Promise((function(t,n){var i=function e(){if(!window.b24form||!window.b24form||!window.b24form.App){setTimeout(e,200)}else{t()}};var r=document.createElement("script");r.src=e.result.loader.app.link;r.onload=i;r.onerror=n;document.head.appendChild(r)}))}r.then(n)["catch"]((function(e){t.message="App load failed:"+e}))}))["catch"]((function(e){t.isLoading=false;t.message=e}))},template:'\n\t\t<div>\n\t\t\t<div v-if="isLoading" class="ui-vue-crm-form-loading-container"></div>\n\t\t\t<div v-else-if="message">{{ message }}</div>\n\t\t</div>\n\t'})})(this.BX.Ui.Vue.Components.Crm=this.BX.Ui.Vue.Components.Crm||{},BX);
//# sourceMappingURL=crm.form.bundle.map.js